cound = 0
def Hanoi(n,fist,second,third):
    global cound
    if n == 1:
        print(fist + '-->' + third)
        cound += 1
    else:
        Hanoi(n-1,fist,third,second)
        print(fist+'-->'+third)
        Hanoi(n-1,second,fist,third)
        cound += 1


Hanoi(4,'A','B','C')
print('一共移动了:',cound)
